package org.vs.controller;

import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.vs.result.RestResult;
import org.vs.service.StaticResourceService;

import javax.annotation.Resource;

/**
 * 文件管理接口
 */
@RestController
@RequestMapping("/static/resource")
public class StaticResourceController {
    @Resource
    private StaticResourceService staticResourceService;

    @PostMapping("/upload")
    public RestResult upload(@RequestParam("file") MultipartFile file) {
        return staticResourceService.upload(file);
    }

    @DeleteMapping("/delete")
    public RestResult delete(@RequestParam("file") String file) {
        return staticResourceService.delete(file);
    }
}
